package cn.wxxyhw.myview;

import cn.wxxyhw.entity.Employee;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class MyConversions implements Converter<String,Employee> {

    @Override
    public Employee convert(String source) {
        System.out.println(source);
        String[] split = source.split("-");
        String id = split[0];
        String lastname = split[1];
        String email = split[2];
        String finner = split[3];

        Employee employee = new Employee(Integer.parseInt(id),lastname,email,finner);
        return employee;
    }
}
